package cn.felord.algorithms.sort;

/**
 * @author Dax
 * @since 9:00  2018/7/14
 */
public class BubbleSort {

    public static int[] sort(int[] arr) {

        int len = arr.length;
        for (int i = 0; i < len; i++) {
            for (int j = i+1; j < len; j++) {
                int temp = arr[i];

                if (temp < arr[j]) {
                    arr[i]=arr[j];
                    arr[j]=temp;
                }
            }
        }
        return arr;
    }

}
